﻿using Newtonsoft.Json;
using System;
using Yunzuan.Foundation.Attributes;
using Yunzuan.Foundation.Entities;
namespace CloudDiamonds.Models.DBModels
{

    [Table(TableName = "yz_customer", PrimaryKey = "CustomerID")]
    public class CustomerInfo : BaseEntity
    {
        #region Private Properties
        private int _customerID;
        private string _userName;
        private string _userPassword;
        private int? _salesUserID;
        private int? _purchaseUserID;
        private string _realName;
        private decimal? _rebate;
        private decimal? _fancyRebate;
        private decimal? _parcelRebate;//统包销售折扣
        private decimal? _ringRebate;//成品销售折扣
        private decimal? _gemRebate;//彩宝销售折扣
        private decimal? _emeraldRebate; //翡翠销售折扣
        private decimal? _primeGoldRebate; //素金销售折扣
        private decimal? _inlaySettingsRebate; //素金销售折扣
        private short? _sex;
        //private string _customerGroup;
        private string _qQ;
        private string _email;
        private string _mobile;
        private string _url;//网站10-12
        //private string _area;
        private DateTime? _lastActiveTime;
        private DateTime? _validdate;
        private int? _loginCount;
        //private int? _diamondCount;
        private string _comments;
        private DateTime? _createTime;
        private DateTime? _updateTime;
        //private string _createIP;
        private short? _sysStatus;
        private string _companyName;
        private decimal? _balance;
        private decimal? _usdbalance;//美金账户余额 01-11
        //private decimal? _pendingtheamount;
        private string _nickName;
        private string _customerkey;
        private string _activeIP;
        private decimal? discounts;//优惠折扣
        private int? isRebate;//优惠倍率

        #endregion



        #region Public Properties
        /// <summary>
        /// CustomerID.
        /// </summary>
        [Column(IsAutoIncrement = true)]
        public int CustomerID
        {
            get
            {
                return _customerID;
            }
            set
            {
                this.ChangeNotify<int>("CustomerID", value, ref _customerID);
            }
        }

        /// <summary>
        /// UserName.
        /// </summary>
        public string UserName
        {
            get
            {
                return _userName;
            }
            set
            {
                this.ChangeNotify<string>("UserName", value, ref _userName);
            }
        }

        /// <summary>
        /// UserPassword.
        /// </summary>
        public string UserPassword
        {
            get
            {
                return _userPassword;
            }
            set
            {
                this.ChangeNotify<string>("UserPassword", value, ref _userPassword);
            }
        }

        /// <summary>
        /// SalesUserID.
        /// </summary>
        public int? SalesUserID
        {
            get
            {
                return _salesUserID;
            }
            set
            {
                this.ChangeNotify<int?>("SalesUserID", value, ref _salesUserID);
            }
        }

        /// <summary>
        /// PurchaseUserID.
        /// </summary>
        public int? PurchaseUserID
        {
            get
            {
                return _purchaseUserID;
            }
            set
            {
                this.ChangeNotify<int?>("PurchaseUserID", value, ref _purchaseUserID);
            }
        }

        /// <summary>
        /// RealName.
        /// </summary>
        public string RealName
        {
            get
            {
                return _realName;
            }
            set
            {
                this.ChangeNotify<string>("RealName", value, ref _realName);
            }
        }

        public string NickName
        {
            get
            {
                return _nickName;
            }
            set
            {
                this.ChangeNotify<string>("NickName", value, ref _nickName);
            }
        }

        /// <summary>
        /// Rebate.
        /// </summary>
        public decimal? Rebate
        {
            get
            {
                if (_rebate == null)
                    this._rebate = 0;
                return _rebate;
            }
            set
            {
                this.ChangeNotify<decimal?>("Rebate", value, ref _rebate);
            }
        }

        /// <summary>
        /// FancyRebate.
        /// </summary>
        public decimal? FancyRebate
        {
            get
            {
                if (_fancyRebate == null)
                    this._fancyRebate = 0;
                return _fancyRebate;
            }
            set
            {
                this.ChangeNotify<decimal?>("FancyRebate", value, ref _fancyRebate);
            }
        }
        //统包销售折扣
        public decimal? ParcelRebate
        {
            get
            {
                return _parcelRebate;
            }
            set
            {
                this.ChangeNotify<decimal?>("ParcelRebate", value, ref _parcelRebate);
            }
        }
        //成品销售折扣
        public decimal? RingRebate
        {
            get
            {
                return _ringRebate;
            }
            set
            {
                this.ChangeNotify<decimal?>("RingRebate", value, ref _ringRebate);
            }
        }
        //彩宝销售折扣
        public decimal? GemRebate
        {
            get
            {
                return _gemRebate;
            }
            set
            {
                this.ChangeNotify<decimal?>("GemRebate", value, ref _gemRebate);
            }
        }
        //彩宝销售折扣
        public decimal? EmeraldRebate
        {
            get
            {
                return _emeraldRebate;
            }
            set
            {
                this.ChangeNotify<decimal?>("EmeraldRebate", value, ref _emeraldRebate);
            }
        }
        //素金销售折扣
        public decimal? PrimeGoldRebate
        {
            get
            {
                return _primeGoldRebate;
            }
            set
            {
                this.ChangeNotify<decimal?>("PrimeGoldRebate", value, ref _primeGoldRebate);
            }
        }
        //素金销售折扣
        public decimal? InlaySettingsRebate
        {
            get
            {
                return _inlaySettingsRebate;
            }
            set
            {
                this.ChangeNotify<decimal?>("InlaySettingsRebate", value, ref _inlaySettingsRebate);
            }
        }
        /// <summary>
        /// Sex.
        /// </summary>
        public short? Sex
        {
            get
            {
                return _sex;
            }
            set
            {
                this.ChangeNotify<short?>("Sex", value, ref _sex);
            }
        }

        /// <summary>
        /// CustomerGroup.
        /// </summary>
        //public string CustomerGroup
        //{
        //    get
        //    {
        //        return _customerGroup;
        //    }
        //    set
        //    {
        //        this.ChangeNotify<string>("CustomerGroup", value, ref _customerGroup);
        //    }
        //}


        /// <summary>
        /// QQ.
        /// </summary>
        public string QQ
        {
            get
            {
                return _qQ;
            }
            set
            {
                this.ChangeNotify<string>("QQ", value, ref _qQ);
            }
        }

        /// <summary>
        /// Email.
        /// </summary>
        public string Email
        {
            get
            {
                return _email;
            }
            set
            {
                this.ChangeNotify<string>("Email", value, ref _email);
            }
        }

        /// <summary>
        /// Mobile.
        /// </summary>
        public string Mobile
        {
            get
            {
                return _mobile;
            }
            set
            {
                this.ChangeNotify<string>("Mobile", value, ref _mobile);
            }
        }

        /// <summary>
        /// Url
        /// </summary>
        public string Url
        {
            get
            {
                return _url;
            }
            set
            {
                this.ChangeNotify<string>("Url", value, ref _url);
            }
        }

        /// <summary>
        /// Area.
        /// </summary>
        //public string Area
        //{
        //    get
        //    {
        //        return _area;
        //    }
        //    set
        //    {
        //        this.ChangeNotify<string>("Area", value, ref _area);
        //    }
        //}

        /// <summary>
        /// LastActiveTime.
        /// </summary>
        public DateTime? LastActiveTime
        {
            get
            {
                return _lastActiveTime;
            }
            set
            {
                this.ChangeNotify<DateTime?>("LastActiveTime", value, ref _lastActiveTime);
            }
        }


        /// <summary>
        /// 活跃IP.
        /// </summary>
        public string ActiveIP
        {
            get
            {
                return _activeIP;
            }
            set
            {
                this.ChangeNotify<string>("ActiveIP", value, ref _activeIP);
            }
        }

        /// <summary>
        /// LoginCount.
        /// </summary>
        public int? LoginCount
        {
            get
            {
                return _loginCount;
            }
            set
            {
                this.ChangeNotify<int?>("LoginCount", value, ref _loginCount);
            }
        }

        /// <summary>
        /// DiamondCount
        /// </summary>
        //public int? DiamondCount
        //{
        //    get { return _diamondCount; }
        //    set { this.ChangeNotify<int?>("DiamondCount", value, ref _diamondCount); }
        //}

        /// <summary>
        /// Comments.
        /// </summary>
        public string Comments
        {
            get
            {
                return _comments;
            }
            set
            {
                this.ChangeNotify<string>("Comments", value, ref _comments);
            }
        }


        /// <summary>
        /// CreateTime.
        /// </summary>
        public DateTime? CreateTime
        {
            get
            {
                return _createTime;
            }
            set
            {
                this.ChangeNotify<DateTime?>("CreateTime", value, ref _createTime);
            }
        }

        /// <summary>
        /// UpdateTime
        /// </summary>
        public DateTime? UpdateTime
        {
            get
            {
                return _updateTime;
            }
            set
            {
                this.ChangeNotify<DateTime?>("UpdateTime", value, ref _updateTime);
            }
        }

        /// <summary>
        /// CreateIP.
        /// </summary>
        //public string CreateIP
        //{
        //    get
        //    {
        //        return _createIP;
        //    }
        //    set
        //    {
        //        this.ChangeNotify<string>("CreateIP", value, ref _createIP);
        //    }
        //}

        /// <summary>
        /// SysStatus.
        /// </summary>
        public short? SysStatus
        {
            get
            {
                return _sysStatus;
            }
            set
            {
                this.ChangeNotify<short?>("SysStatus", value, ref _sysStatus);
            }
        }

        /// <summary>
        /// CompanyName.
        /// </summary>
        /// 
        public string CompanyName
        {
            get
            {
                return _companyName;
            }
            set
            {
                this.ChangeNotify<string>("CompanyName", value, ref _companyName);
            }
        }

        /// <summary>
        /// 活跃地区
        /// </summary>
        private string _activeArea;

        public string ActiveArea
        {
            get { return _activeArea; }
            set
            {
                this.ChangeNotify<string>("ActiveArea", value, ref _activeArea);
            }
        }

        /// <summary>
        /// 介绍人Introducer
        /// </summary>
        private string _introducer;

        public string Introducer
        {
            get { return _introducer; }
            set
            {
                this.ChangeNotify<string>("Introducer", value, ref _introducer);
            }
        }

        /// <summary>
        /// Balance.
        /// </summary>
        public decimal? Balance
        {
            get
            {
                return _balance;
            }
            set
            {
                this.ChangeNotify<decimal?>("Balance", value, ref _balance);
            }
        }

        /// <summary>
        /// USDBalance
        /// </summary>
        public decimal? USDBalance
        {
            get
            {
                return _usdbalance;
            }
            set
            {
                this.ChangeNotify<decimal?>("USDBalance", value, ref _usdbalance);
            }
        }

        /// <summary>
        /// PendingtheAmount.
        /// </summary>
        //public decimal? PendingtheAmount
        //{
        //    get
        //    {
        //        return _pendingtheamount;
        //    }
        //    set
        //    {
        //        this.ChangeNotify<decimal?>("PendingtheAmount", value, ref _pendingtheamount);
        //    }
        //}

        /// <summary>
        /// KEY
        /// </summary>
        public string CustomerKey
        {
            get
            {
                return _customerkey;
            }
            set
            {
                this.ChangeNotify<string>("CustomerKey", value, ref _customerkey);
            }
        }
        /// <summary>
        /// 有效日期
        /// </summary>
        public DateTime? ValidDate
        {
            get
            {
                return _validdate;
            }
            set
            {
                this.ChangeNotify<DateTime?>("ValidDate", value, ref _validdate);
            }
        }
        #endregion
        /// <summary>
        /// Discounts
        /// </summary>
        public decimal? Discounts
        {
            get
            {
                if (discounts == null || discounts <= 0)
                    this.discounts = 1;
                return discounts;
            }
            set
            {
                this.ChangeNotify<decimal?>("Discounts", value, ref discounts);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public int? IsRebate
        {
            get
            {
                if (isRebate == null || isRebate < 0)
                    this.isRebate = 1;
                return isRebate;
            }
            set
            {
                this.ChangeNotify<int?>("IsRebate", value, ref isRebate);
            }
        }

        private string _roleNames;
        public string RoleNames
        {
            get
            {
                return _roleNames;
            }
            set
            {
                this.ChangeNotify<string>("RoleNames", value, ref _roleNames);
            }
        }
        private string _openId;
        public string OpenId
        {
            get
            {
                return _openId;
            }
            set
            {
                this.ChangeNotify<string>("OpenId", value, ref _openId);
            }
        }

    }
}
